<?php
use yii\helpers\Html;
use yii\helpers\Url;
/* @var $this yii\web\View */
$this->title = '项目详情-产品资料';
?>
<section id="body_h">
		<div class="modular11">
			<ul class="clearfix mould11-tit">
				<li data-cato="mould-11list1" class="current2"><a href="javascript:;">相关图片</a></li>
				<li data-cato="mould-11list2" data-url="investlist"><a href="javascript:;">投资记录</a></li>
			</ul>
			<ul id="mould-11list1" class="mould11-con1 mould11-con hide">
			<?php if ($infos){foreach ($infos as $K=>$V){?>
				<li><img width="100%" src="<?= $V;?>" alt=""></li>
			<?php }}?>
			</ul>
			<div class="wh-container">
			<div id="mould-11list2" class="modular5-con mould11-con hide">
				<table id="mould-11list2-1">
					
				</table>
			</div>
		  </div>
		</div>
		<div class="footer-h"></div>
	</section>
	<section id="footer">
			<ul class="footer-nav clearfix">
			    <li class="current-bot">
			        <a href="<?= Url::to('main');?>">
			            <img src="<?= Yii::getAlias('@web') . '/' ?>images/footer1-on.png" alt="">
			            首页
			        </a>
			    </li>
			    <li>
			        <a href="<?= Url::to('member');?>">
			            <img src="<?= Yii::getAlias('@web') . '/' ?>images/footer2.png" alt="">
			            我的账户
			        </a>
			    </li>
			    <li>
			        <a href="<?= Url::to(['company/about']);?>">
			            <img src="<?= Yii::getAlias('@web') . '/' ?>images/footer3.png" alt="">
			            关于我们
			        </a>
			    </li>
			</ul>
	</section>
<script src="<?= Yii::getAlias('@web') . '/' ?>js/reset.js"></script>
	<script>
	$(function($) {
	    var UA=window.navigator.userAgent;  //使用设备
	    var CLICK="click";
	    if(/ipad|iphone|android/.test(UA)){   //判断使用设备
	        CLICK="tap";
	    }
	    var id='mould-11list1';
		var url = 'investlist';
        var page=1;//当前页
        var ul_obj = $('#'+id+' #mould-11list2-1'); //数据加载的位置
	    var catoFram=$(".mould11-con");
	    var subNav=$(".mould11-tit li");
	    $("#mould-11list1").removeClass("hide");
	    subNav[0].className += " current2" ;
	    subNav[CLICK](function(event){
            event.preventDefault();
            $(".bodyA").show();
	        var _this=$(this);
	        id=_this.data("cato"); 
	        var cur=$("#"+id);
	        ul_obj = $('#'+id+' #mould-11list2-1'); //数据加载的位置
			url = _this.data("url");
			page=1;
	        subNav.removeClass("current2");
	        _this.addClass("current2");
	        catoFram.addClass("hide");
	        cur.scrollTop(0);        
	        cur.removeClass("hide");
	        if(id=="mould-11list1")
	        {
	        	$(".bodyA").hide();
				return false;
		     }
	        $.ajax({
                type: 'GET',
                url: url+'?page='+page+'&num=15&id='+'<?= $id;?>',
                dataType: 'text',
                success: function(json){
					var dataObj=eval("("+json+")");
					var type;
			        ul_obj.find("tr").remove();	//移除列表内容
			        ul_obj.append('<tr class="modular5-conttit"><td class="modular5-con1h">投资人</td><td class="modular5-con1h">投资金额</td><td class="modular5-con1h">类型</td><td class="modular5-con1h">时间</td></tr>');
					$.each(dataObj.list,function(i,val){
						if(val.type == 0){type='自动';}else if(val.type == 1){type='手动';}
						ul_obj.append('<tr><td class="modular5-con1h">'+val.username+'</td><td class="modular5-con1h">'+fmoney(val.money)+'</td><td class="modular5-con1h">'+type+'</td><td class="modular5-con1h">'+val.time.substr(0,10)+'</td></tr>');
					});
                    
                    $(".loading").remove();//删除加载图片
                    ajax=!1;//注明已经完成ajax加载
                },
                error: function(xhr, type){
                    $(".loading").html("暂无内容！");
                }
            });
            $(".bodyA").hide();
	    });
	  //需要 zepto.js支持
        var ajax=!1;//是否加载中
        Zepto(function($){
            $(window).scroll(function(){
                if(($(window).scrollTop() + $(window).height() > $(document).height()-40) && !ajax){
                    
                    //滚动条拉到离底40像素内，而且没ajax中，而且没超过总页数
					if(id=="mould-11list1")
			        {
			        	$(".bodyA").hide();
						return false;
				     }
                    page++;//当前页增加1
                    ajax=!0;//注明开始ajax加载中
                    $(".wh-container").append('<div class="loading" style="text-align:center;  font-size:16px; color:#999; "><img  style="vertical-align: middle; margin-right:10px;" src="<?= yii::getAlias('@web').'/' ?>images/loading1.gif" alt="" />上拉加载</div> ');//出现加载图片
					
                    $.ajax({
                        type: 'GET',
                        url: url+'?page='+page+'&num=15&id='+'<?= $id;?>',
                        dataType: 'text',
                        success: function(json){
							var dataObj=eval("("+json+")");
							var type;
							if(dataObj.list)
							{
								$.each(dataObj.list,function(i,val){
									if(val.type == 0){type='自动';}else if(val.type == 1){type='手动';}
									ul_obj.append('<tr><td class="modular5-con1h">'+val.username+'</td><td class="modular5-con1h">'+fmoney(val.money)+'</td><td class="modular5-con1h">'+type+'</td><td class="modular5-con1h">'+val.time.substr(0,10)+'</td></tr>');
								});
	                            
	                            $(".loading").remove();//删除加载图片
	                            ajax=!1;//注明已经完成ajax加载
							}
							else
							{
								$(".loading").html("暂无内容！");
	                            ajax=!0;
							}
                        },
                        error: function(xhr, type){
                            $(".loading").html("暂无内容！");
                            ajax=!0;
                        }
                    });
                }
            });
        });
		$(".bodyA").hide();
	});
	function fmoney(strNum) {
		if (strNum.length <= 3) {
		return strNum;
		}
		if (!/^(\+|-)?(\d+)(\.\d+)?$/.test(strNum)) {
		return strNum;
		}
		var a = RegExp.$1, b = RegExp.$2, c = RegExp.$3;
		var re = new RegExp();
		re.compile("(\\d)(\\d{3})(,|$)");
		while (re.test(b)) {
		b = b.replace(re, "$1,$2$3");
		}
		return a + "" + b + "" + c;
		}
</script>
<script src='<?= Yii::getAlias('@web') . '/' ?>js/zepto.min.js'></script>